package gmusic.ma.bo;

import gmusic.bo.ArtistBean;
import gmusic.services.impl.GMusicServicesImpl;

import java.io.Serializable;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ArtistMABean extends ArtistBean implements Serializable {

	protected List<ReleaseMABean> releasesMA = new ArrayList<ReleaseMABean>();

	protected int paysMaid = -1;

	// Information non persistante en BD
	private String alternativeName = null;

	private String genre;

	private String lyricalTheme;

	public ArtistMABean() {
	}

	public ArtistMABean(ResultSet rs) throws SQLException {
		setMaid(rs.getLong("maid"));
		setNom(rs.getString("nom"));
		setPaysMaid(rs.getInt("pays_id"));
		setURLLogo(rs.getString("url_logo"));
		setStatut(rs.getInt("statut"));
	}

	public ArtistMABean(long maid) {
		setMaid(maid);
	}

	/** @deprecated */
	public ArtistMABean(long maid, String nom) {
		setMaid(maid);
		setNom(nom);
	}

	/*
	 * public ArtistMABean(long id, String nom) { this.maid = id; this.nom =
	 * nom; }
	 */

	public List<ReleaseMABean> getReleasesMA() {
		return releasesMA;
	}

	public void setReleasesMA(List<ReleaseMABean> releases) {
		this.releasesMA = releases;
	}

	public void addRelease(ReleaseMABean r) {
		releasesMA.add(r);
	}

	public String toString() {
		return "[maid=" + maid + ";nom=" + nom + ";paysId=" + paysMaid + "]";
	}

	public String toString4Console() {
		return maid + "\t" + nom;
	}

	public boolean existsInGM() throws SQLException {
		return GMusicServicesImpl.getInstance().artistMAExists(maid);
	}

	public int getPaysMaid() {
		return paysMaid;
	}

	public void setPaysMaid(int paysMaid) {
		this.paysMaid = paysMaid;
	}

	public String getAlternativeName() {
		return alternativeName;
	}

	public void setAlternativeName(String alternativeName) {
		this.alternativeName = alternativeName;
	}

	public String getGenre() {
		return genre;
	}

	public void setGenre(String genre) {
		this.genre = genre;
	}

	public String getLyricalTheme() {
		return lyricalTheme;
	}

	public void setLyricalTheme(String lyricalTheme) {
		this.lyricalTheme = lyricalTheme;
	}
}
